package com.jzo2o.customer.controller.consumer;


import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.service.IServeProviderService;
import com.jzo2o.mvc.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 机构端相关接口
 *
 * @author itcast
 **/
@RestController("consumerAgencyController")
@RequestMapping("/agency")
@Api(tags = "服务端 - 服务人员相关接口")
public class AgencyController {
    @Resource
    private IServeProviderService serveProviderService;

    @PostMapping("/bank-account")
    @ApiOperation("新增或更新银行账号信息")
    public Result<Void> upsertBankAccount(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO) {
        serveProviderService.upsertBankAccount(bankAccountUpsertReqDTO);
        return Result.ok();
    }

    @GetMapping("/bank-account/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号")
    public BankAccount currentUserBankAccount() {
        BankAccount BankAccount = serveProviderService.currentUserBankAccount();
        return BankAccount;
    }

}
